class Frontend::BaseController <  ApplicationController
  before_action :logged_in?

  helper_method :current_user

  layout 'frontend'
  private

  def current_user
    # @user = User.first if Settings.development_mode
    @user ||= User.find_by(id: session[:current_user_id])
  end


  def logged_in?
    if session[:current_user_id].present?
      return true
    else
      redirect_to frontend_login_path
    end
  end

  def set_current_user(user)
    session[:current_user_id] = user.id
  end


end
